package com.agan.aganalgorithm.test;

import java.util.concurrent.*;

/**
 * @author agan
 * @ClassName Demo
 * @Description
 * @Date 2021/4/8 10:57 下午
 **/
public class Demo {

    private static ExecutorService executorService = new ThreadPoolExecutor(10, 10, 30L, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(100), new ThreadFactory() {
        @Override
        public Thread newThread(Runnable r) {
            Thread t = new Thread(r);
            System.out.println("我是线程a"+t);
            return t;
        }
    }, new ThreadPoolExecutor.AbortPolicy());

    public static void main(String[] args) {


        final Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("1aaaa");
            }
        });

        final Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    t1.join();
                    System.out.println("2bbbb");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }
        });


        Thread t3 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    t2.join();
                    System.out.println("3cccc");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }
        });


        System.out.println("早上：");
        System.out.println("测试人员来上班了...");
        t3.start();
        System.out.println("产品经理来上班了...");

        System.out.println("开发人员来上班了...");
        t2.start();
        t1.start();







    }
}
